# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

  def truncate_title(text, length = 3, truncate_string = "...")
    words = text.split()
    words[0..(length-1)].join(' ') + (words.length > length ? truncate_string : ' ')
  end
  
  def truncate_content(text, length = 10, truncate_string = "...")
    words = text.split()
    words[0..(length-1)].join(' ') + (words.length > length ? truncate_string : ' ')
  end
end
